<template>
  <div class="large-screen-display">
    <lsd-header />
    <search-element @showOnMap="showOnMap" @refreshPoints="refreshPoints" />
    <el-container style="height: 100%">
      <el-main style="padding: 0"><vue-map ref="vueMap" /></el-main>
      <el-aside :width="asideWidth" style="padding: 0; transition: width 1s"
        ><kanban ref="kanban" :isCollapsed.sync="isKanbanCollapsed"
      /></el-aside>
    </el-container>
  </div>
</template>

<script>
import vueMap from "./components/map";
import lsdHeader from "./components/header";
import kanban from "./components/kanban";

import searchElement from "./components/searchElement";

export default {
  name: "Index",
  components: { vueMap, lsdHeader, kanban, searchElement },
  data() {
    return {
      isKanbanCollapsed: false,
      points: [],
    };
  },
  computed: {
    asideWidth() {
      return this.isKanbanCollapsed ? "0" : "375px";
    },
  },
  methods: {
    showOnMap(deviceId, fenceObj, elementType) {
      if (elementType == 4) {
        //代表围栏
        this.$refs.vueMap.showPolygon(fenceObj);
      } else {
        this.$refs.vueMap.showMarker(deviceId);
      }
    },

    refreshPoints(points) {
      this.$refs.vueMap.refreshPoints(points);
      this.$refs.kanban.refreshAllData();
    },
  },
  mounted() {},
};
</script>

<style lang="scss">
.large-screen-display {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
</style>
